home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2004 #11
/
Amiga Plus CD - 2004 - No. 11.iso
/
AmiSoft
/
Biz
/
swood
/
FW_Scripts.lha
/
FW_Scripts
/
ComplexShape
/
ComplexShape.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
2004-08-17
|
2KB
|
89 lines
/* ================================ */
/* FINAL WRITER AREXX MACRO */
/* Create complex shapes from lines */
/* $VER: ComplexShape 1.0 (2.7.04) */
/* ================================ */
Options Results
SetMeasure MICROPOINTS
/* Get a list of all the selected objects. */
i = 0
FirstObject SELECTED
IF ( Result = 0 ) THEN DO
ShowMessage 1 0 '"No lines selected." "" "" "OK" "" ""'
EXIT
END
DO WHILE ( Result ~= 0 )
i = I + 1
Object.i = Result
NextObject Object.i SELECTED
END
x = 0
DO WHILE ( x < i )
x = x + 1
GetObjectType Object.x
objtype.x = Result
IF (objtype.x ~= 2 & objtype.x ~= 3) THEN DO
ShowMessage 1 0 '"Wrong object type selected." "" "" "OK" "" ""'
EXIT
END
/* Get the coordinates */
GetObjectCoords Object.x
PARSE VAR Result page.x x1.x y1.x x2.x y2.x
END
closepath = 0
x = 0
DO WHILE ( x < i )
x = x + 1
IF x = 1 THEN DO
StartPath page.x x1.x y1.x
oldx = x1.x
oldy = y1.x
startx = x1.x
starty = y1.x
END
/* Make a closed path if ends are within 50 micropoints */
IF (x = i) & (ABS(startx - x2.x) < 50) & (ABS(starty - y2.x) < 50) THEN DO
x2.x = startx
y2.x = starty
closepath = 1
END
IF objtype.x = 2 THEN DO
LineTo page.x x2.x y2.x
END
ELSE DO
midx = (oldx + x2.x) / 2
midy = (oldy + y2.x) / 2
cp1x = (oldx + midx) % 2
cp1y = (oldy + midy) % 2
cp2x = (midx + x2.x) % 2
cp2y = (midy + y2.x) % 2
CurveTo page.x cp1x cp1y cp2x cp2y x2.x y2.x
END
IF x = i THEN DO
IF closepath THEN
EndPath CLOSE
ELSE
EndPath
Redraw
SetMeasure RULER
EXIT
END
oldx = x2.x
oldy = y2.x
END